#! /bin/sh

source /etc/rc.d/common

check_args ${@}

start() {
    # Check file systems for any possible errors
    /bin/echo "Checking all file systems..."
    /usr/sbin/fsck -A -M -T -p
    if [ $? -gt 1 ]; then
        /bin/echo "ERROR (fsck): Your file system appears to be severely damaged."
        /bin/echo "ERROR (fsck): You can probably correct this problem by running fsck.FSTYPE manually."
        exit 1
    fi

    # If we got this far, mount the file systems
    /bin/echo "Mounting local file systems..."
    for i in `/usr/bin/awk '{print $2}' /etc/fstab`; do
        if [ "${i:0:1}" == "/" ]; then
            if [ ! -d "${i}" ]; then
                /bin/mkdir -p ${i}
            fi
        fi
    done
    /bin/mount -a
}

stop() {
    # Do nothing
    :
}

status() {
    # We don't know anything
    exit ${UNKNOWN}
}

# Perform specified action
${1}
